/*
 * Copyright 2009 SHOP.COM
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.shop.opensocial.mediated.services;

import com.shop.opensocial.mediated.types.DataCollectionMediator;
import com.shop.opensocial.mediated.types.GroupIdMediator;
import com.shop.opensocial.mediated.types.SecurityTokenMediator;
import com.shop.opensocial.mediated.types.UserIdMediator;
import com.shop.opensocial.mediated.request.MediatedRequest;
import java.util.Map;
import java.util.Set;

/**
 * Independent mediator for OpenSocial App Data Service
 *
 * @author Jordan Zimmerman
 */
public interface AppDataServiceMediator
{

	/**
	 * Retrives app data for the specified user list and group.
	 *
	 * @param request request data
	 * @param userIds A set of UserIds.
	 * @param groupId The group
	 * @param appId The app
	 * @param fields The fields to filter the data by. Empty set implies all
	 * @param token The security token
	 * @return The data fetched
	 * @throws Exception errors
	 */
	public DataCollectionMediator getPersonData(MediatedRequest request, Set<UserIdMediator> userIds, GroupIdMediator groupId, String appId, Set<String> fields, SecurityTokenMediator token) throws Exception;

	/**
	 * Deletes data for the specified user and group.
	 *
	 * @param request request data
	 * @param userId The user
	 * @param groupId The group
	 * @param appId The app
	 * @param fields The fields to delete. Empty set implies all
	 * @param token The security token
	 * @throws Exception errors
	 */
	public void deletePersonData(MediatedRequest request, UserIdMediator userId, GroupIdMediator groupId, String appId, Set<String> fields, SecurityTokenMediator token) throws Exception;

	/**
	 * Updates app data for the specified user and group with the new values.
	 *
	 * @param request request data
	 * @param userId  The user
	 * @param groupId The group
	 * @param appId The app
	 * @param fields The fields to filter the data by. Empty set implies all
	 * @param values The values to set
	 * @param token The security token
	 * @throws Exception errors
	 */
	public void updatePersonData(MediatedRequest request, UserIdMediator userId, GroupIdMediator groupId, String appId, Set<String> fields, Map<String, String> values, SecurityTokenMediator token) throws Exception;
}
